import Vue from "vue";
import ComponentTemplate from "./index.vue";
const VueComponent = Vue.extend(ComponentTemplate);

export const dialogCategory = (option: any) => {
    const vm: any = new VueComponent().$mount();
    vm.model = {
        ...vm.model,
        ...option.model
    };
    vm.showIcon = option.showIcon || false;
    vm.showColor = option.showColor || false;
    vm.iconList = option.iconList || [];
    vm.$on("onchange", (item: any) => {
        if (option && option.onChange) option.onChange(vm, item);
    });
    vm.$on("sure", (model: any) => {
        if (option && option.sure) option.sure(vm, model);
    });
    vm.$on("onclose", (model: any) => {
        if (option && option.close) option.close(vm, model);
    });
    vm.show = true;
    return vm;
};
